xen/arm: traps: Emulate ICC_SRE_EL1 as RAZ/WI
authorJulien Grall <julien.grall@arm.com>
Mon, 5 Dec 2016 17:43:23 +0000 (17:43 +0000)
committerStefano Stabellini <sstabellini@kernel.org>
Thu, 16 Mar 2017 20:44:56 +0000 (13:44 -0700)
commit308c646ee6f11fa87d67343005942a3186a69206
treebf952dde0c7d6e067f56e76c67876186ef0d0edd
parentfceae911f6e7af87cd31321385d779b47eff1857
xen/arm: traps: Emulate ICC_SRE_EL1 as RAZ/WI

Recent Linux kernel (4.4 and onwards [1]) is checking whether it is possible
to enable sysreg access (ICC_SRE_EL1.SRE) when the ID register
(ID_AA64PRF0_EL1.GIC) is reporting the presence of the sysreg interface.

When the guest has been configured to use GICv2, the hypervisor will
disable sysreg access for this vm (via ICC_SRE_EL2.Enable) and therefore
access to system register such as ICC_SRE_EL1 are trapped in EL2.

However, ICC_SRE_EL1 is not emulated by the hypervisor. This means that
Linux will crash as soon as it is trying to access ICC_SRE_EL1.

To solve this problem, Xen can implement ICC_SRE_EL1 as read-as-zero
write-ignore. The emulation will only be used when sysreg are disabled
for EL1.

[1]  963fcd409 "arm64: cpufeatures: Check ICC_EL1_SRE.SRE before
enabling ARM64_HAS_SYSREG_GIC_CPUIF"

Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
xen/arch/arm/traps.c
xen/include/asm-arm/sysregs.h